package cn.unknowpupil.init.domain.system;

import com.baomidou.mybatisplus.annotation.TableName;
import cn.unknowpupil.init.configure.mybatisplus.base.SuperEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * Created at 2020-11-13 by  w10g <br>
 * Initialize SysRole  ... <br>
 *  角色表
 *
 * @author unknowpupil
 * @since 0.0.1
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_role")
@ApiModel(value = "SysRole 域", description = "角色表")
public class SysRole extends SuperEntity<SysRole> {

private static final long serialVersionUID=1L;
    /**
     * 角色名称
     */
    @ApiModelProperty(value = "角色名称")
    @TableField(value ="name")
    private String name;
    /**
     * 角色描述
     */
    @ApiModelProperty(value = "角色描述")
    @TableField(value ="role_desc")
    private String roleDesc;

    @TableField(value ="role")
    private String role;
    /**
     * 权限列表
     */
    @TableField(exist = false)
    private Long [] permissionIds;


    public boolean isAdmin() {

        return isAdmin(this.getId());
    }
    public static boolean isAdmin(Long roleId) {
        return roleId != null && 1L == roleId;
    }

}